<!--
 * @Descripttion: 
 * @Author: YuZhenJing
 * @Date: 2020-06-21 20:42:29
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-06-26 11:40:21
-->
<!DOCTYPE html>
<html lang="zh_CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // m 多行匹配
      let ay = `
        #1 js,200元 #
        #2 php,300元 #
        #9 anyun.com # 安云
        #3 node.js,180元#
      `;
      let lessons = ay.match(/^\s*#\d\s+.+\s+#$/gm).map((a) => {
        a = a.replace(/\s*#\d\s/g, "").replace(/\s*#/, "");
        [name, price] = a.split(",");
        return { name, price };
      });
      console.log(JSON.stringify(lessons));
      let reg = /(\d+),?/y;
      reg.lastIndex = 6;
      let text = "会员QQ：11111111,22222222 普通会员: 33333333";
      console.log(reg.exec(text));
      console.log(reg.exec(text));
      console.log(reg.exec(text));
    </script>
  </body>
</html>
